#!/usr/bin/env python
# by claydodo
"""Usage: rangefmt [start:]end[:step] [fmt_str]"""

import sys

if len(sys.argv) == 1:
    print "Usage: rangefmt [start:]end[:step] [fmt_str]"
    sys.exit(1)

r_str = sys.argv[1].split(':')
r_int = [int(item) for item in r_str]

fmt = '%d'
if len(sys.argv) > 2:
    fmt = sys.argv[2]

start = 0
step = 1

if len(r_int) == 1:
    end = r_int[0]
elif len(r_int) == 2:
    start = r_int[0]
    end = r_int[1]
elif len(r_int) == 3:
    start = r_int[0]
    end = r_int[1]
    step = r_int[2]

end += 1

numbers = range(start, end, step)

for item in numbers:
    print fmt % item , 
